All Questions
113 questions
5votes
1answer
76views
Parsing Lists: BIO 2024 Q2
I was practising question 2a of the British Informatics Olympiad 2024 past paper. In this task you will manipulate lists of integers to create new lists. There are three fundamental lists that you ...
8votes
1answer
2kviews
Mathematical expression evaluator (C++)
I'm new to C++ and I decided to experiment with the language, by writing a mathematical expression evaluator, using the Shunting-Yard algorithm. A design choice that may stand out as weird is the fact ...
4votes
1answer
150views
Preprocessing invalid xml before feeding it to a parser
As part of a larger project I'm writing to learn C++, I'm trying to read through some almost-XML files generated by another program. Unfortunately this program uses its own custom escaping logic, so ...
1vote
2answers
81views
Extracting items from comma/semicolon-delimited strings, discarding parts after a hyphen
New Scala dev here. Is there a more idiomatic or efficient way to accomplish this in Scala? Given a list of the following strings, I need to obtain the unique 'main parts' once any parts including ...
7votes
1answer
2kviews
Count characters, words, and lines in files (wc in rust)
I wrote a barebones version of wc in rust. wc is a program that counts the number of characters, words, and lines in a file and ...
3votes
2answers
4kviews
Separate an email address into its username and domain name
This is my first ever Python program and I wanted to get everyone's opinions on it. The goal of the program is to separate an email address into its username and domain name. ...
1vote
1answer
143views
Company database REPL program in Rust for Chapter 8 of The Book
Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company. For example, “Add Sally to Engineering” or “Add Amir to Sales.” Then let the ...
2votes
1answer
2kviews
Simple Haskell Parser
I'm very new to haskell (I never used Monads, Functors and other things) and FP in general. I decided to write the simplest parser I possibly can with some expansion possibilities. (I have a general ...
4votes
2answers
489views
Counting Characters from an HTML File with Python
I just completed level 2 of The Python Challenge on pythonchallenge.com and I am in the process of learning python so please bear with me and any silly mistakes I may have made. I am looking for some ...
3votes
1answer
928views
Parse selected records from empty-line separated file
This is my first post here and I hope I will get some recommendations to improve my code. I have a parser which processes the file with the following structure: ...
5votes
1answer
860views
Lexer written in Rust
So I ported a lexer I wrote in C++ over to rust, as I'm starting to learn rust. Since I'm very new though, I don't know any Idioms and good practices in rust. So if anyone could point out some (...
7votes
3answers
4kviews
Parsing molecular formula
Is it possible to improve this code in terms of efficiency / line number ? (avoid nested code ...). It comes from a test I failed. I don't know how I could have done it better. ...
3votes
0answers
68views
Implementing chat commands [closed]
I'm new to C++ and I'm writting some kind of chat server and client who talk to each other through commands for learning purposes. I serialize and deserialize these commands using a JSON library. My ...
4votes
1answer
74views
Rendering the AuthorName using the DOMParser to read XML
I need to concatenate the LastName and Initials and all of that authors affiliations. Is there a better way or faster way to do ...
3votes
2answers
755views
Implementation of tree with different node types and faux-polymorphism in C
I'm currently learning C by working on my first project. It's a calculator with a parser that transforms input into an operator tree. These trees consist of nodes of different types: Operators (inner ...